package com.designlollipopdemo;

import android.os.Bundle;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;

public class Actvity_CoordinatorLayout extends AppCompatActivity {

    public CoordinatorLayout coordinatorLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_actvity__coordinator_layout);
        coordinatorLayout = (CoordinatorLayout) findViewById(R.id.coordinatorlayot);
    }

    public void test(View view)
    {
        switch (view.getId())
        {
            case R.id.floatbtn:
                Snackbar.make(coordinatorLayout,"这是message",Snackbar.LENGTH_INDEFINITE)
                        .setAction("Action", new View.OnClickListener() {
                            @Override
                            public void onClick(View v)
                            {
                                Toast.makeText(Actvity_CoordinatorLayout.this,"点击事件",Toast.LENGTH_LONG).show();
                            }
                        })
                        .show();


                //simple use

          /*      Snackbar.make(coordinatorLayout, "这是message", Snackbar.LENGTH_INDEFINITE).show();*/
                break;
        }

    }
}
